import 'whatwg-fetch'

const next = fetch;

export default function Fetch(url,params){
    // init params
    params = params || {};
    params.method = params.method || 'GET';
    params.credentials = params.credentials ||  'include';

    if(params.method == 'POST' && !params.headers){
        let myHeaders = new Headers();
        myHeaders.append('Content-Type', 'application/json');
        params.headers = myHeaders;
    }
    return fetch(url,params);
}
